home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / c-runtime / tests / error.m < prev    next >
Encoding:
Text File  |  1992-08-18  |  932 b   |  58 lines

  1. /* -*-objc-*- */
  2.  
  3. /* 
  4.   $Header$
  5.   $Author: dglattin $
  6.   $Date$
  7.   $Log$
  8.  */
  9.  
  10. #include  <Object.h>
  11. #include  <stdio.h>
  12.  
  13.  
  14. @interface SubClass1 : Object {}
  15. + ( int )return12;
  16. - ( int )return15;
  17. @end
  18.  
  19. @implementation SubClass1
  20. + ( int )return12 { return 12; }
  21. - ( int )return15 { return 15; }
  22. @end
  23.  
  24.  
  25.  
  26. @interface SubClass4 : SubClass1 {}
  27. + ( int )return12;
  28. - ( int )return15;
  29. @end
  30.  
  31. @implementation SubClass4
  32. + ( int )return12 { 
  33.  
  34.                             /* Due to compiler design, 
  35.                               this should not be a infinite loop. */
  36.   [ SubClass1 new ];    
  37.   [ SubClass4 new ];    
  38.   return [ super return12 ] + 1 ; 
  39. }
  40.  
  41.  
  42. - ( int )return15 { 
  43.  
  44.  
  45.   [ SubClass1 new ];    /* Due to compiler design, 
  46.                               this should not be a infinite loop. */
  47.   return [ super return15 ]; 
  48. }
  49. @end
  50.  
  51.  
  52.  
  53. void  main (void) {
  54.  
  55.  
  56.   [ SubClass4 poseAs:[ SubClass1 class ]];
  57.   printf ("%d\n", [ SubClass4 return12 ]);
  58. }